
ticketHub.controller('localOrderManageCtrls',function($scope,$http){
	$scope.postData = {			
			orderId:"",
			supplierOrderId:"",
			startTime:"",
			endTime:"",
			supplierPNR:"",
			status:""
	};
	$scope.query = function(curr){
		var params = function(){
			var startTime = "";
			var endTime = "";
			if($scope.postData.startTime!=""){
				startTime += $scope.postData.startTime+" 00:00:00";
			}
			if($scope.postData.endTime!=""){
				endTime += $scope.postData.endTime+" 23:59:59";
			}
			return {
				orderId:$scope.postData.orderId,
				supplierOrderId:$scope.postData.supplierOrderId,
				startTime:startTime,
				endTime:endTime,
				supplierPNR:$scope.postData.supplierPNR,
				status:$scope.postData.status,
				pageNum:curr||1

			}
		}()		
		layer.load(3,{shadeClose:true});//加载层；
		$http({
			url:'../order/findLocalOrderList?pageSize=10&temp='+Math.random(),
			method:'get',
			params:params
		}).success(function(data,header,config,status){			
			layer.closeAll();			
			if(data.status=="1001"){
				if(data.data.total=="0"){
					layer.alert("查询结果为空!");
				}else{
					$scope.list = data.data.list;
					//共多少页
					 var pages = Math.ceil(data.data.total/10);  	
					  //分页
					 laypage({
					    cont: $('#laypage'), //容器。值支持id名、原生dom对象，jquery对象,
					    pages: pages, //总页数
					    skip: true, //是否开启跳页
					    skin: '#AF0000',
					    curr: curr || 1, //当前页
					    groups: 10, //连续显示分页数
					    jump: function(obj, first){ //触发分页后的回调
				          if(!first){ //点击跳页触发函数自身，并传递当前页：obj.curr
				        	  $scope.query(obj.curr);
				          }
				        }
					});
				}				
			}else{
				layer.alert(data.message)
			}
			//响应成功
		}).error(function(data,header,config,status){
			layer.closeAll();	
			console.log(data)
			layer.alert("请求失败，请检查网络连接")
			//处理响应失败
		});
	}
	$scope.query();
})
	
	
